{% extends "base.html" %}  
{% block title %} 患者列表 {% endblock %}  

{% block content %} 

  <div class="container">

    <!-- Docs nav
    ================================================== -->
    <div class="row">
      <div class="span3 bs-docs-sidebar">
        <ul class="nav nav-list bs-docs-sidenav">
        <li><a href="{% url sle.views.list_follow %}"><i class="icon-chevron-right"></i> 返回列表</a></li>
        <li><a href="#pfxt"><i class="icon-chevron-right"></i>评分系统</a></li>
        <li><a href="#fzjc"><i class="icon-chevron-right"></i>辅助检查</a></li>     
        </ul>
      </div>
      
      

<div class="span9">
             
                         
              
              
               <section id="pfxt">
          <div class="page-header">
            <h2>评分系统</h2>
          </div>

        
<div class="bs-docs-example">
{% if Incentive_instance %}
  {% for ii in Incentive_instance %}
   <form id="pfxt_form" action="{% url sle.views.update_Follow %}" method="POST" class="form-inline" >{% csrf_token %}
  <label class="control-label" for="Infection">SSDDI</label>
  <input name="ssddi" id="ssddi" type="text" class="input-small" placeholder="SSDDI" />
  <label class="control-label" for="Pregnancy">SSDI </label>
  <input name="ssdi" id="ssdi" type="text" class="input-small" placeholder="SSDI" /><br/><br/>
  <label class="control-label" for="Drugs">ESSDAI</label>
  <input name="essdai" id="essdai" type="text" class="input-small" placeholder="ESSDAI"  />
  <label class="control-label" for="Drugs">ESSPRI</label>
  <input name="esspri" id="esspri" type="text" class="input-small" placeholder="ESSPRI"  /><br/><br/>
  <label class="control-label" for="Tired">sf-12/PCS</label>
  <input name="PCS" type="text" class="input-small" id="PCS" placeholder="sf-12/PCS"  />
    <label class="control-label" for="Menopause">sf-12/MCS</label>
  <input name="MCS" type="text" class="input-small" id="MCS" placeholder="sf-12/MCS"  /><br/><br/>
      <label class="control-label" for="Others">中医诊断</label>
  <input name="pcm" type="text" class="input-small" id="pcm" placeholder="中医诊断" />
        <label class="control-label" for="Fitment">舌诊/脉诊</label>
  <input name="tongue" type="text" class="input-small" id="tongue" placeholder="舌诊/脉诊"  /><br/><br/>
        <label class="control-label" for="Psychogenic">其它</label>
  <input name="other" type="text" class="input-small" id="other" placeholder="其它"  />
          <label class="control-label" for="Psychogenic">随访日期</label>
  <input name="inputdate" type="text" class="input-small" id="inputdate_sf" placeholder="随访日期"  /><br/><br/>


  <button id="hzyy_submit" type="submit" class="btn btn-info" style="float:right;">更新</button>
</form>
  {% endfor %}
  {% else %}
  <form id="pfxt_form" action="{% url sle.views.save_Follow %}" method="POST" class="form-inline" >{% csrf_token %}
  <label class="control-label" for="Infection">SSDDI</label>
  <input name="ssddi" id="ssddi" type="text" class="input-small" placeholder="SSDDI" />
  <label class="control-label" for="Pregnancy">SSDI </label>
  <input name="ssdi" id="ssdi" type="text" class="input-small" placeholder="SSDI" /><br/><br/>
  <label class="control-label" for="Drugs">ESSDAI</label>
  <input name="essdai" id="essdai" type="text" class="input-small" placeholder="ESSDAI"  />
  <label class="control-label" for="Drugs">ESSPRI</label>
  <input name="esspri" id="esspri" type="text" class="input-small" placeholder="ESSPRI"  /><br/><br/>
  <label class="control-label" for="Tired">sf-12/PCS</label>
  <input name="PCS" type="text" class="input-small" id="PCS" placeholder="sf-12/PCS"  />
    <label class="control-label" for="Menopause">sf-12/MCS</label>
  <input name="MCS" type="text" class="input-small" id="MCS" placeholder="sf-12/MCS"  /><br/><br/>
      <label class="control-label" for="Others">中医诊断</label>
  <input name="pcm" type="text" class="input-small" id="pcm" placeholder="中医诊断" />
        <label class="control-label" for="Fitment">舌诊/脉诊</label>
  <input name="tongue" type="text" class="input-small" id="tongue" placeholder="舌诊/脉诊"  /><br/><br/>
        <label class="control-label" for="Psychogenic">其它</label>
  <input name="other" type="text" class="input-small" id="other" placeholder="其它"  />
          <label class="control-label" for="Psychogenic">随访日期</label>
  <input name="inputdate" type="text" class="input-small" id="inputdate_sf" placeholder="随访日期"  /><br/><br/>
<input name="patient_id" id="patient_id" type="hidden" />
  <button id="hzyy_submit" type="submit" class="btn btn-info" style="float:right;">保存</button>
</form>
  {% endif %}
</div>


        
        </section>
              
              
              
              
              
              
              <section id="fzjc">
          <div class="page-header">
            <h2>辅助检查</h2>
          </div>

        
<div class="bs-docs-example">
{% if Incentive_instance %}
  {% for ii in Incentive_instance %}
   <form id="fzjc_form" action="{% url sle.views.update_Labfindings %}" method="POST" class="form-inline" >{% csrf_token %}
  <label class="control-label" for="Infection">ANA</label>
  <input name="ANA" id="ANA" type="text" class="input-small" placeholder="ANA" value="{{ii.Infection}}"/>
  <label class="control-label" for="Pregnancy">anti-ENA-Ab: Sm </label>
  <input name="anti" id="anti" type="text" class="input-small" placeholder="anti-ENA-Ab: Sm" value="{{ii.Pregnancy}}"/>
  <label class="control-label" for="Drugs">SSA/Ro </label>
  <input name="SSA/Ro" id="SSA/Ro" type="text" class="input-small" placeholder="SSA/Ro"  value="{{ii.Drugs}}"/><br/><br/>
  <label class="control-label" for="Tired">劳累 </label>
  <input name="Tired" type="text" class="input-small" id="Tired" placeholder="劳累"  value="{{ii.Tired}}"/>
    <label class="control-label" for="Menopause">绝经</label>
  <input name="Menopause" type="text" class="input-small" id="Menopause" placeholder="绝经"  value="{{ii.Menopause}}"/>
      <label class="control-label" for="Others">其他</label>
  <input name="Others" type="text" class="input-small" id="Others" placeholder="其他"  value="{{ii.Others}}"/><br/><br/>
        <label class="control-label" for="Fitment">居室装修</label>
  <input name="Fitment" type="text" class="input-small" id="Fitment" placeholder="居室装修"  value="{{ii.Fitment}}"/>
        <label class="control-label" for="Psychogenic">精神因素</label>
  <input name="Psychogenic" type="text" class="input-small" id="Psychogenic" placeholder="精神因素"  value="{{ii.Psychogenic}}"/><br/><br/>
  <input type="hidden" value="{{ii.id}}" name="incentive_id"/>

  <button id="hzyy_submit" type="submit" class="btn btn-info" style="float:right;">更新</button>
</form>
  {% endfor %}
  {% else %}
  <form id="hzyy_form" action="{% url sle.views.save_Labfindings %}" method="POST" class="form-inline" >{% csrf_token %}
  <label class="control-label" for="Infection">ANA</label>
  <input name="ANA" id="ANA" type="text" class="input-small" placeholder="ANA" value=""/>
  <label class="control-label" for="Pregnancy">anti-ENA-Ab: Sm </label>
  <input name="anti_ENA_Ab" id="anti_ENA_Ab" type="text" class="input-small" placeholder="anti-ENA-Ab: Sm" value=""/>
  <label class="control-label" for="Drugs">SSA/Ro </label>
  <input name="SSA" id="SSA" type="text" class="input-small" placeholder="SSA/Ro"  value=""/><br/><br/>
  <label class="control-label" for="Tired">SSB/La </label>
  <input name="SSB" type="text" class="input-small" id="SSB" placeholder="SSB/La"  value=""/>
    <label class="control-label" for="Menopause"> RNP</label>
  <input name="RNP" type="text" class="input-small" id="RNP" placeholder=" RNP"  value=""/>
      <label class="control-label" for="Others">Jo-1</label>
  <input name="Jo" type="text" class="input-small" id="Jo" placeholder="Jo-1"  value=""/><br/><br/>
        <label class="control-label" for="Fitment">Scl-70</label>
  <input name="Scl" type="text" class="input-small" id="Scl" placeholder="Scl-70"  value=""/>
        <label class="control-label" for="Psychogenic">dsDNA-Ab</label>
  <input name="dsDNA" type="text" class="input-small" id="dsDNA" placeholder="dsDNA-Ab"  value=""/>
          <label class="control-label" for="Psychogenic">MPO- ANCA</label>
  <input name="MPO" type="text" class="input-small" id="MPO" placeholder="dsDNA-Ab"  value=""/><br/><br/>
          <label class="control-label" for="Fitment">PR3-ANCA</label>
  <input name="PR3" type="text" class="input-small" id="PR3" placeholder="PR3-ANCA"  value=""/>
        <label class="control-label" for="Psychogenic">anti-CCP-Ab</label>
  <input name="anti_CCP_Ab" type="text" class="input-small" id="anti_CCP_Ab" placeholder="anti-CCP-Ab"  value=""/>
          <label class="control-label" for="Psychogenic">anticardiolipin antibody</label>
  <input name="anticardiolipin" type="text" class="input-small" id="anticardiolipin" placeholder="anticardiolipin antibody"  value=""/><br/><br/>
  <label class="control-label" for="Fitment">RF</label>
  <input name="RF" type="text" class="input-small" id="RF" placeholder="RF"  value=""/>
        <label class="control-label" for="Psychogenic"> serum IgG</label>
  <input name="serum" type="text" class="input-small" id="serum" placeholder=" g/L"  value=""/>
          <label class="control-label" for="Psychogenic">IgM</label>
  <input name="IgM" type="text" class="input-small" id="IgM" placeholder=" g/L"  value=""/><br/><br/>
    <label class="control-label" for="Fitment">IgA</label>
  <input name="IgA" type="text" class="input-small" id="IgA" placeholder=" g/L"  value=""/>
        <label class="control-label" for="Psychogenic">C3</label>
  <input name="C3" type="text" class="input-small" id="C3" placeholder=" g/L"  value=""/>
          <label class="control-label" for="Psychogenic">C4</label>
  <input name="C4" type="text" class="input-small" id="C4" placeholder=" g/L"  value=""/><br/><br/>
      <label class="control-label" for="Fitment">CH50</label>
  <input name="CH50" type="text" class="input-small" id="CH50" placeholder="CH50"  value=""/>
        <label class="control-label" for="Psychogenic">曾服用过的治疗SS药物、用法、疗程及起止时间</label>
  <input name="SS" type="text" class="input-small" id="SS" placeholder="曾服用过的治疗SS药物、用法、疗程及起止时间"  value=""/>
          <label class="control-label" for="Psychogenic">糖皮质激素</label>
  <input name="hormone" type="text" class="input-small" id="hormone" placeholder="糖皮质激素"  value=""/><br/><br/>
        <label class="control-label" for="Fitment">CTX</label>
  <input name="CTX" type="text" class="input-small" id="CTX" placeholder="CTX"  value=""/>
        <label class="control-label" for="Psychogenic">MTX</label>
  <input name="MTX" type="text" class="input-small" id="MTX" placeholder="MTX"  value=""/>
          <label class="control-label" for="Psychogenic">Aza</label>
  <input name="Aza" type="text" class="input-small" id="Aza" placeholder="Aza"  value=""/><br/><br/>
          <label class="control-label" for="Fitment">CQ/HCQ</label>
  <input name="CQ" type="text" class="input-small" id="CQ" placeholder="CQ/HCQ"  value=""/>
        <label class="control-label" for="Psychogenic">反应停</label>
  <input name="reaction" type="text" class="input-small" id="reaction" placeholder="反应停"  value=""/>
          <label class="control-label" for="Psychogenic">X-ray Film</label>
  <input name="X_ray" type="text" class="input-small" id="X_ray" placeholder="X-ray Film"  value=""/><br/><br/>
          <label class="control-label" for="Fitment">CT Scan</label>
  <input name="CT" type="text" class="input-small" id="CT" placeholder="CT Scan"  value=""/>
        <label class="control-label" for="Psychogenic">ECG </label>
  <input name="ECG" type="text" class="input-small" id="ECG" placeholder="ECG"  value=""/>
          <label class="control-label" for="Psychogenic">UCG</label>
  <input name="UCG" type="text" class="input-small" id="UCG" placeholder="UCG"  value=""/><br/><br/>
            <label class="control-label" for="Fitment">Pulmonary Function Test</label>
  <input name="Pulmonary" type="text" class="input-small" id="Pulmonary" placeholder="Pulmonary Function Test"  value=""/>
        <label class="control-label" for="Psychogenic">EEG </label>
  <input name="EEG" type="text" class="input-small" id="EEG" placeholder="EEG"  value=""/>
          <label class="control-label" for="Psychogenic">ultrasonagraphy</label>
  <input name="ultrasonagraphy" type="text" class="input-small" id="ultrasonagraphy" placeholder="UCG"  value=""/><br/><br/>
              <label class="control-label" for="Fitment">EMG</label>
  <input name="EMG" type="text" class="input-small" id="EMG" placeholder="EMG"  value=""/><br/><br/>
        <label class="control-label" for="Psychogenic">Labial Biopsy </label>
  <input name="Labial" type="text" class="input-small" id="Labial" placeholder="Labial Biopsy"  value=""/>
          <label class="control-label" for="Psychogenic">pathology NO.</label>
  <input name="pathologyNO1" type="text" class="input-small" id="pathologyNO1" placeholder=""  value=""/>
            <label class="control-label" for="Psychogenic">date</label>
  <input name="date" type="text" class="input-small" id="date" placeholder="UCG"  value=""/><br/><br/>
          <label class="control-label" for="Psychogenic">Renal Biopsy </label>
  <input name="Renal" type="text" class="input-small" id="Renal" placeholder="Renal Biopsy"  value=""/>
          <label class="control-label" for="Psychogenic">pathology NO.</label>
  <input name="pathologyNO2" type="text" class="input-small" id="pathologyNO2" placeholder=""  value=""/>
            <label class="control-label" for="Psychogenic">date</label>
  <input name="date1" type="text" class="input-small" id="date1" placeholder=""  value=""/><br/><br/>
          <label class="control-label" for="Psychogenic">Bone Marrow Biopsy </label>
  <input name="Bone" type="text" class="input-small" id="Bone" placeholder="Bone Marrow Biopsy"  value=""/>
          <label class="control-label" for="Psychogenic">pathology NO.</label>
  <input name="pathologyNO3" type="text" class="input-small" id="pathologyNO3" placeholder=""  value=""/>
            <label class="control-label" for="Psychogenic">date</label>
  <input name="date3" type="text" class="input-small" id="date3" placeholder=""  value=""/><br/><br/>
  <label class="control-label" for="Psychogenic">其他</label>
  <input name="other" type="text" class="input-small" id="other" placeholder="其他"  value=""/>
    <label class="control-label" for="Psychogenic">检查日期</label>
  <input name="inputdate" type="text" class="input-small" id="inputdate" placeholder="检查日期"  value=""/>
  <input name="patient_id" id="patient_id" type="hidden" />


  <button id="fzjc_submit" type="submit" class="btn btn-info" style="float:right;">保存</button>
</form>
  {% endif %}
</div>


        
        </section>
       
</div>

</div>
</div>


{% endblock %} 

{% block some_js %}

<script type="text/javascript">

var flag = 1;
var newpn = '';
var newpn1 = '';

$("#add_PatientNo").click(function(){
  
    
    flag++;
	var $label = $("<div id='remove_pn"+flag+"'><label class='control-label' for='PatientNo'>门诊号码 </label><input type='text' class='input-small' id='PatientNo"+flag+"' placeholder='门诊号' >  <button class='btn btn-mini btn-primary' onclick='deltr("+flag+")' type='button'>删除门诊号</button><br/></div>");	
  
  $("#add_PatientNo").after($label);
  

  });
 
 
 $("#add_hospitNo").click(function(){
  
    
    flag++;
	var $label = $("<div id='remove_ph"+flag+"'><label class='control-label' for='hospitalized'>住院号码 </label><input type='text' class='input-small' id='hospitalized"+flag+"' placeholder='住院号' >  <button class='btn btn-mini btn-primary' onclick='deltr2("+flag+")' type='button'>删除住院号</button><br/></div>");	
  
  $("#add_hospitNo").after($label);
  

  });



  
 
 $(document).ready(function() {
 
 
 $('#hzzl_form').validate({
 rules: {
			patient_name: "required",
			patient_age: {    
       						digits: true,
    						required: true
							},
			patient_birthdate:"dateISO",
			patient_company:"required",
			patient_home:"required",
			patient_tel: {    
       						digits: true,
							required: true
							},
			patient_card: {    
       						digits: true,
							required: true
							},
			patient_native:"required",
			patient_inputdate:"dateISO",
			patient_number: {    
       						digits: true,
							required: true
							},
			patient_gender:"required",	
			Patient_no: {    
       						digits: true,
							required: true
							},
			hospitalized_no: {    
       						digits: true,
							required: true
							},
			
		},
		messages: {
			patient_name: "必填",
			patient_age: "数字",
			patient_birthdate: "请输入正确的日期",
						patient_company:"必填",
			patient_home:"必填",
			patient_tel: "格式",
			patient_native: "必填",
			patient_inputdate: "请输入正确的日期",
			patient_number: "必填",
			patient_gender: "必填",	
			Patient_no: "数字",
			hospitalized_no: "数字",
			patient_card:"数字"

		
		},
		errorElement: "em",				//用来创建错误提示信息标签
		success: function(label) {			//验证成功后的执行的回调函数
			//label指向上面那个错误提示信息标签em
			label.text(" ")				//清空错误提示消息
				.addClass("success");	//加上自定义的success类
		}
		
 
 });
 
 
  //提交开始
 $('#flbz_form').submit(function() {
		$('#showmessage').css("display","block");
		$.ajax({ // create an AJAX call...
                data: $(this).serialize(), // get the form data
                type: $(this).attr('method'), // GET or POST
                url: $(this).attr('action'), // the file to call
                success: function(response,textStatus) { // on success..
				$('#showmessage').text('信息已经更新!');
                  
				  setTimeout(function() {
				  $('#showmessage').css("display","none");
				  }, 1500);
               window.location.href="{% url sle.views.list_patient %}";
                }
            });
            return false;

		});//提交结束 
 
 
 
 //提交开始
 $('#tjbg_form').submit(function() {
		$('#showmessage').css("display","block");
		$.ajax({ // create an AJAX call...
                data: $(this).serialize(), // get the form data
                type: $(this).attr('method'), // GET or POST
                url: $(this).attr('action'), // the file to call
                success: function(response,textStatus) { // on success..
				$('#showmessage').text('信息已经更新!');
                 
				  setTimeout(function() {
				  $('#showmessage').css("display","none");
				  }, 1500);
               
                }
            });
            return false;

		});//提交结束 
 
 //提交开始
 $('#hzls_form').submit(function() {
		$('#showmessage').css("display","block");
		$.ajax({ // create an AJAX call...
                data: $(this).serialize(), // get the form data
                type: $(this).attr('method'), // GET or POST
                url: $(this).attr('action'), // the file to call
                success: function(response,textStatus) { // on success..
				$('#showmessage').text('信息已经更新!');
                  
				  setTimeout(function() {
				  $('#showmessage').css("display","none");
				  }, 1500);
               
                }
            });
            return false;

		});//提交结束 
 
 

 //提交开始
 $('#bqyb_form').submit(function() {
		$('#showmessage').css("display","block");
		$.ajax({ // create an AJAX call...
                data: $(this).serialize(), // get the form data
                type: $(this).attr('method'), // GET or POST
                url: $(this).attr('action'), // the file to call
                success: function(response,textStatus) { // on success..
				$('#showmessage').text('信息已经更新!');
                  
				  setTimeout(function() {
				  $('#showmessage').css("display","none");
				  }, 1500);
               
                }
            });
            return false;

		});//提交结束 

 
 //提交开始
 $('#hzbz_form').submit(function() {
		$('#showmessage').css("display","block");
		$.ajax({ // create an AJAX call...
                data: $(this).serialize(), // get the form data
                type: $(this).attr('method'), // GET or POST
                url: $(this).attr('action'), // the file to call
                success: function(response,textStatus) { // on success..
				$('#showmessage').text('信息已经更新!');
                  
				  setTimeout(function() {
				  $('#showmessage').css("display","none");
				  }, 1500);
               
                }
            });
            return false;
        
		
		
		});//提交结束  
 
        $('#hzyy_form').submit(function() {
		$('#showmessage').css("display","block");
		$.ajax({ // create an AJAX call...
                data: $(this).serialize(), // get the form data
                type: $(this).attr('method'), // GET or POST
                url: $(this).attr('action'), // the file to call
                success: function(response,textStatus) { // on success..
				$('#showmessage').text('信息已经更新!');
                  
				  setTimeout(function() {
				  $('#showmessage').css("display","none");
				  }, 1500);
               
                }
            });
            return false;
        
		
		
		});//提交结束
          
 
 
 
        $('#hzzl_form').submit(function() { // catch the form's submit event
                
        
		var new_patientno = $('input[id^=PatientNo]');
		var new_hospno = $('input[id^=hospitalized]');
		
		$.each(new_hospno,function(i){
  
  		if(i>0){
  		newpn1+='-'+this.value;
  		}else{
  		newpn1+=this.value;
  		}
  
  		});
		
		
        $.each(new_patientno,function(i){
  
  		if(i>0){
  		newpn+='-'+this.value;
  		}else{
  		newpn+=this.value;
  		}
  
  		});
		
		
        $('input[id=new_patno]').val(newpn);
		$('input[id=new_hosno]').val(newpn1);
//		$('input[id=recordNo]').val('{{patient_instance.patient_number}}');
        $('#showmessage').css("display","block");
		
        
            $.ajax({ // create an AJAX call...
                data: $(this).serialize(), // get the form data
                type: $(this).attr('method'), // GET or POST
                url: $(this).attr('action'), // the file to call
                success: function(response,textStatus) { // on success..

				if(response==1){
				
				$('#showmessage').text('信息已经更新!');
				
                 
				  
				  setTimeout(function() {
				  $('#showmessage').css("display","none");
				  }, 1500);
				  
				  
                   }//if end
                }
            });
            return false;
        });//提交结束
        
        
   
    }); //onready end 
    
    
 
 
   var deltr =function(index)
    {

    $("#remove_pn"+index).remove();
    
  }
  
  var deltr2 =function(index)
    {

    $("#remove_ph"+index).remove();
    
  }
 
 /* 
$('#recordNo').blur(function(){

$.ajax({ // create an AJAX call...
                data: {patient_number:$('#recordNo').val()}, // get the form data
                type: "GET", // GET or POST
                url: "{% url sle.views.check_record %}", // the file to call
                success: function(response,textStatus) { // on success..
                  if (response==1){
				  alert("此登记号已经使用过,请换号!");
				  $('#recordNo').focus();
				  }
                
                }
            });
            return false;
        });
		*/
  
  
  
 
  </script>

{% endblock %}